package com.qianfeng.chainmobile.api.controller;

import com.qianfeng.chainmobile.api.dto.SmsParamBodyContent;
import com.qianfeng.chainmobile.api.dto.SmsParamBodyTemp;
import com.qianfeng.chainmobile.api.service.SmsService;
import com.qianfeng.smsplatform.common.dto.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api")
public class SmsApiController {

    private SmsService smsService;
    @Autowired
    public void setSmsService(SmsService smsService) {
        this.smsService = smsService;
    }
    @PostMapping("/sendsms")
    public R sendMsm(@RequestBody SmsParamBodyContent bodyContent, HttpServletRequest request){
        smsService.sendMsgByContent(bodyContent,request.getRemoteAddr());
        return R.ok();
    }

    @PostMapping("/sendsmstemp")
    public void sendMsm(@RequestBody SmsParamBodyTemp bodyContent) {

    }
}
